home *** CD-ROM | disk | FTP | other *** search
/ Merciful 1 / Merciful - Disc 1.iso / software / r / resource / resource.txt next >
Encoding:
Text File  |  1995-10-14  |  42.0 KB  |  900 lines

  1.                                 RESOURCE
  2.  
  3.  
  4.  
  5. TO GET STARTED QUICKLY:
  6.       Don't forget to put arp.library in your LIBS: directory!
  7.  
  8.       Run ReSource from a CLI, and when you are presented with a file
  9.       requester, select an executable file to disassemble (anything
  10.       within your "C" directory will do nicely).  Alternatively, you
  11.       may disassemble Kickstart by supplying a filename of "*".  Once
  12.       loaded, you may scroll forwards/backwards through the file with
  13.       the down/up arrow keys.  Using the shift key with the up/down
  14.       arrow keys will move you faster through the file.  You may also
  15.       use mouse-scrolling, by holding the left mouse button down, then
  16.       SLOWLY moving the mouse forwards or backwards, depending on which
  17.       way you want to move through the file.  While moving forwards
  18.       with the mouse, holding the left Amiga key down will start the
  19.       label creation process, in a controlled manner.  When labels are
  20.       created, ReSource decides which type of data is being labelled,
  21.       and it is generally correct in its judgement.  Once you have made
  22.       some labels, select the 'Fill-in data types' menu item, under the
  23.       "DISPLAY" menu.  Once you have created labels from all areas of
  24.       code, select 'Fill-in data types' again, and you may then scroll
  25.       through the file, checking for yourself that all is in order
  26.       (there will occasionally be cases where ReSource made an
  27.       incorrect judgement, and code made be shown as ASCII, or vice-
  28.       versa).  Use one of the "Set data types" sub-menu selections, to
  29.       set the correct data type.  Remember to use the "Fill-in data
  30.       types" command again, so that code and data are shown correctly.
  31.  
  32.       If you are working on a large file, you may wish to save your
  33.       work, so that you can continue it at a later time.  To do this,
  34.       select "save all" under the "PROJECT" menu.  When you use the
  35.       "save all" option, you are creating a "ReSource file", as it is
  36.       only useable by ReSource.  By default, the filename will end in
  37.       ".RS".  You may change this if you like.
  38.  
  39. ABOUT RESOURCE:
  40.       ReSource is an interactive disassembler.  To give you an idea of
  41.       which files can and cannot be disassembled, the following is a
  42.       list of files from a Workbench 1.2 disk, that ReSource can
  43.       disassemble:
  44.       C directory: all
  45.       L directory: all
  46.       LIBS directory: all
  47.       DEMOS directory: Boxes, Dots, Spots
  48.       SYSTEM directory: CLI, DiskCopy, Format, GraphicDump, IconEd,
  49.       Say, SetMap.
  50.       DEVS directory: all keymaps, all printer drivers, everything
  51.       ending in ".device".
  52.       FONTS directory: everything within sub-directories
  53.       (topaz/11,emerald/17, etc.)
  54.       UTILITIES directory: Calculator, Notepad
  55.       ROOT directory: Preferences, Clock
  56.  
  57.       I personally wanted a good disassembler to fix bugs in many of
  58.       the public domain programs that I use.  I was also interested in
  59.       getting to know how C programs worked, at the assembly language
  60.       level.  ReSource is the result of 3 and a half months full-time
  61.       effort; during this time I have been using each version
  62.       extensively.  I am very impatient when it comes to waiting for
  63.       programs to complete operations, this has resulted in a
  64.       disassembler that is extremely fast, at the cost of memory usage.
  65.       Even though ReSource was written purely in assembly language, it
  66.       uses lots of memory, especially when disassembling large
  67.       programs.  Generally, if you have 1.5 Megs of memory, you will be
  68.       able to disassemble most programs.  To disassemble Kickstart, you
  69.       will require at least 2 Megs if you have a hard drive, or 3.5
  70.       Megs if you do not have a hard drive.  As a further condition,
  71.       there must be at least 1.1 Megs of contiguous memory, for the
  72.       attributes table.
  73.  
  74. GENERAL USAGE:
  75.       Don't forget to put arp.library in your LIBS: directory!
  76.  
  77.       Disassembling a program consists of examining a load file
  78.       (sometimes called "executable" or "object" files), and from the
  79.       information contained therein, create a text file (assembler
  80.       source code) which, when assembled, can be used identically to
  81.       the original load file.  It takes many, often hundreds, of hours
  82.       of painstaking work to become proficient at disassembling even a
  83.       small program manually.  Even experts can spend many hours
  84.       disassembling very small programs, while large Amiga programs may
  85.       take weeks.  From now on, this will not be the case with Amiga
  86.       programs.  Large programs (100K or larger) can be disassembled in
  87.       an evening, while small programs (such as CD, PROMPT, AVAIL,
  88.       ECHO, FILENOTE, etc., take around 3-5 seconds to produce re-
  89.       assemblable source code.
  90.  
  91.       As an example, let's disassemble LoadWB, which you'll find in the
  92.       C directory of just about any booting disk, including a standard
  93.       Workbench disk (make sure that it comes from a V1.2 Workbench,
  94.       not 1.1 or 1.3!  At the CLI prompt, type:
  95.  
  96.       RUN RS C:LOADWB
  97.  
  98.       You don't really have to use the "run" command, but I find it
  99.       convenient, so maybe you will too.  When ReSource starts running,
  100.       it will load the file "loadwb" from the C directory, and
  101.       disassemble the first page for you.  We can now start the label-
  102.       creation process.  This involves getting ReSource to examine
  103.       lines of code, and on each line, if there is any reference to
  104.       another part of the program, ReSource will decide which type of
  105.       data is being referenced.  For example, the first line of code in
  106.       our program is:
  107.  
  108.               MOVE.L  SP,START+$01E0
  109.  
  110.       Okay, go to the menus, under "LABELS" menu, you'll find "Create
  111.       single".  A sub-menu box will pop out, and from this, select
  112.       "Address symbol dest".  Now, the first line of code in our
  113.       program should be:
  114.  
  115.               MOVE.L  SP,lbL0001E0
  116.  
  117.       Now, scroll forward through the program (using shift-down arrow),
  118.       until you find a line starting with "lbL0001E0":
  119.  
  120.       lbL0001E0       dc.l    0
  121.  
  122.       The label "lbL0001E0" is something that ReSource has just now
  123.       created.  In this case, ReSource decided that the data being
  124.       referenced was a Longword, hence the "L" in "lbL0001E0".  If it
  125.       was code that was being referenced, the label would have been
  126.       "lbC0001E0" instead.  There are five type of data recognized by
  127.       ReSource:
  128.  
  129.       ASCII - CODE - BYTES - WORDS - LONGWORDS
  130.  
  131.       The processes involved in deciding which type of data is being
  132.       referenced is quite complex, and such things as the surrounding
  133.       code/data, the relative position of reloc32 areas, hunk types,
  134.       relative position from the start of a hunk, the actual
  135.       information being referenced, whether the data is word/longword
  136.       aligned, the actual instruction from which the reference was
  137.       derived, the proximity of other labels, and what data types they
  138.       refer to, all take part in the decision-making process.  If the
  139.       first line of code in out program had been:
  140.  
  141.               MOVE.W  SP,START+$01E0
  142.  
  143.       , then the label created would have been "lbW0001E0" instead, and
  144.       the data type at this label would have been set to words.  If you
  145.       like, you can manually set the data type of any byte in the
  146.       program, by selecting a sub-menu item from the "Set data type"
  147.       menu item, under "DISPLAY" in the menus.  This will not create a
  148.       label, but it will re-define the current byte within the file (on
  149.       the top line of the display) as being ASCII, CODE, or whichever
  150.       data type you selected.  Generally, this is not required, except
  151.       sometimes in large programs, but after letting ReSource do its
  152.       thing first.  If you like doing things with the mouse, you can
  153.       even set the data type this way.  Once you have mastered mouse
  154.       scrolling, try holding down the left-shift key while still
  155.       holding down the left mouse button.  This will display everything
  156.       as if it were set to the data type BYTES.  Holding down the left
  157.       alt key will display everything as if it were set to ASCII.
  158.       Similarly, the left shift and left alt keys held down together to
  159.       show everything in WORDs; hold down the ctl key and everything
  160.       will be displayed as CODE.  Hold down all three, and everything
  161.       will be shown as LONGWORDS.  If you decide make this data type
  162.       permanent, press the menu button, and the current position within
  163.       the program will be set to the data type currently being
  164.       displayed.  By holding down the right alt key, you can remove
  165.       labels while scrolling.
  166.  
  167.       Now scroll back to the start of the program (select "Start of
  168.       file" submenuitem, under the "Absolute" menuitem under the
  169.       "CURSOR" menu).  Alternatively, just use the up arrow key, to
  170.       scroll back slowly.  Look in the screen title bar to find out how
  171.       far you are from the start of the file.  This offset is being
  172.       shown in hexdecimal.  Now, use the down arrow key to scroll
  173.       forward to the second line of code in our program:
  174.  
  175.               MOVE.L  D0,START+$01E8
  176.  
  177.       Again, select the "Address symbol dest" submenuitem, to create
  178.       the label "lbL0001E8".  Do this to as many lines of code as you
  179.       like, so that you become familiar with the label creating
  180.       process.  What you have just done can be done far quicker, by
  181.       using the "Create multiple" label functions.  Firstly, select the
  182.       "Open" menuitem, under "PROJECT" in the menus.  Again, we will
  183.       use "LoadWB" from within your C directory.  Once it is loaded,
  184.       look in the menu under "LABELS", go to the menuitem "Create
  185.       multiple", and select "All" from the sub-menuitem box.  Around
  186.       three quarters of a second later, you should be at position
  187.       "0001C8" relative from the start of the file.  The top line of
  188.       the display should read:
  189.  
  190.       lbL0001C8       dc.l    0
  191.  
  192.       If this is correct, you should now find some more code to make
  193.       labels from.  To do this, you could use the down arrow key to
  194.       scroll forward, the shift-arrow key to page forward, or let
  195.       ReSource do the searching for you, by selecting "Next unparsed
  196.       code" from the "CURSOR" menu.  If there is no more code that has
  197.       not been parsed, you will be returned to the start of the file.
  198.       However in this case, there is more code to parse, so go to it!
  199.       When eventually "Next unparsed code" returns you to the start of
  200.       the file, slowly scroll through the file, and examine as you go.
  201.       You should find some ASCII, but it isn't being shown like it
  202.       really should.  This is the time to select "Fill-in data types"
  203.       from the "DISPLAY" menu.
  204.  
  205.       Okay, now the program is completely disassembled right?  Well,
  206.       nearly.  If you followed the above instructions to the letter,
  207.       there will be once more section of code that labels have NOT been
  208.       created from.  This will be at offset "000584".  This is because
  209.       this area of the program was only recognized as code, after it
  210.       had been skipped over.  In fact, the only reference to this part
  211.       of the program is made at offset "0005E6", and the code is:
  212.  
  213.               JSR     lbC000584
  214.  
  215.       Again, create multiple labels within this area, and search for
  216.       the next unparsed code.  If you select "Next unparsed code" while
  217.       at the start of the file, and ReSource cannot find any, then
  218.       again select "Fill-in data types", and this should complete the
  219.       disassembly of LoadWB.
  220.  
  221.       Actually, at this point, I generally will change some of the
  222.       labels, so that they are meaningful.  For instance, the first
  223.       line of code places the contents of the SP register at
  224.       "lbL0001E0", right?  Scroll forward to the line starting with
  225.       this label, and select "Address symbol" submenuitem, from the
  226.       "Create single" menuitem, under "LABELS" menu.  You will be
  227.       requested to input a new label name.  I would call this label
  228.       "SaveSP"; you call it anything you like.  Now, scroll backwards
  229.       to the offset "0000D2":
  230.  
  231.               MOVE.L  SaveSP,SP
  232.  
  233.       We didn't change this line, so what is going on?  You have just
  234.       witnessed one of the major benefits of an interactive
  235.       disassembler; any label changes you make are reflected throughout
  236.       the entire program, instantly.  Anywhere else in the program that
  237.       you can place a meaningful label, will help greatly in
  238.       recognizing how a program executes, without actually executing
  239.       it.  Also, if you wish to make changes to the source, meaningful
  240.       labels help greatly.  While still within ReSource, you may add
  241.       comments, both full-line, and end-of-line, to aid in the
  242.       understanding of the program.
  243.  
  244. EXPLANATION OF FUNCTIONS:
  245.       The following section gives details of the uses of each function,
  246.       as they are shown in the menus.  Not all functions are enabled in
  247.       all versions, this is especially so in V0.x (demo version).
  248.  
  249.       PROJECT/Abort:
  250.               Use this to abort out of most functions.
  251.  
  252.       PROJECT/Open:
  253.               Requests you to select a file to open.  Use this function
  254.       to load executable files, as well as ReSource files.
  255.  
  256.       PROJECT/Restore:
  257.               Same as PROJECT/Open, but assumes that you wish to open
  258.       the same file as you last opened.
  259.  
  260.       PROJECT/Save .RS:
  261.               Saves the file that you are currently working on, in a
  262.       form useable only by ReSource.  Also saves the current location
  263.       with the file.  To continue work on the file later, use the
  264.       PROJECT/Open function.
  265.  
  266.       PROJECT/About:
  267.               Gives you some specific details about the version of
  268.       ReSource that you are currently using.
  269.  
  270.       PROJECT/Quit:
  271.               Asks you for confirmation, then quits without saving.
  272.  
  273.       OUTPUT/Save .asm:
  274.               Saves current file in assembler source code format.
  275.  
  276.       OUTPUT/O/P directory:
  277.               Requests you to supply the name of a directory that .asm
  278.       files will be sent to (you can still change this when you supply
  279.       the name of the output file, it just makes it easier if you are
  280.       disassembling many files).
  281.  
  282.       OUTPUT/Tabs:
  283.               Use to select between real tabs (ASCII value 9) and
  284.       spaces being used in the output source code.
  285.  
  286.       DISPLAY/Hiliting:
  287.               Selective use of inverse video can be useful to give
  288.       extra information about parts of a file.  For instance, you may
  289.       want to get a quick idea of which parts of a file came from a BSS
  290.       hunk, rather than CODE or DATA hunks.  To do this, select
  291.       DISPLAY/Hiliting/BSS hunks.
  292.  
  293.       DISPLAY/Hiliting/Reloc32:
  294.               I find it particularly useful to hilite the Reloc32
  295.       areas, especially when determining data types (reloc32 is
  296.       documented in the Amiga technical reference manual.  It
  297.       ultimately means that a number of longwords in the file point to
  298.       somewhere in memory, relative to the start of one of the hunks of
  299.       the file.  This almost always end up being somewhere within the
  300.       file.  This information helps ReSource greatly when defining data
  301.       types).
  302.  
  303.       DISPLAY/Hiliting/Chip load hunks:
  304.               Certain hunks of a load file may only be loaded into chip
  305.       memory.  Usually, graphics, especially sprites, will be included
  306.       in one of these special hunks, and this information is sometimes
  307.       useful, especially when you intend to re-assemble the file.
  308.       "Chip load hunks" will hilite these hunks for you, also fast load
  309.       hunks may be hilited.
  310.  
  311.       DISPLAY/Hiliting/Symbol scan:
  312.               For all lines that you have created labels from, these
  313.       lines will be hilited.
  314.  
  315.       DISPLAY/Hiliting/Data type uncertain:
  316.               For most labels that ReSource creates automatically, it
  317.       is certain of the data type that it assigns.  Sometimes though,
  318.       it cannot be 100% sure, and this function will hilite all lines
  319.       that fall into this category.
  320.  
  321.       DISPLAY/Hiliting/Data type known:
  322.               Similar to above function, only the lines where the
  323.       ReSource was certain of the data type, will be hilited.
  324.  
  325.       DISPLAY/Hiliting/Internally produced refs:
  326.               All lines which have a label that was created by
  327.       ReSource, will be hilited.
  328.  
  329.       DISPLAY/Set data type:
  330.               When you are certain of which type of data that you are
  331.       looking at, select from one of the submenu items:
  332.       Code - Ascii - Bytes - Words - Longwords
  333.  
  334.       DISPLAY/Set numeric base:
  335.               By default, all numbers are shown in hexdecimal (base
  336.       16).  You can change this to ASCII, DECIMAL or BINARY on any line
  337.       by selecting from the appropriate sub-menu item.  To change back
  338.       to HEXDECIMAL, simply select the same function again.  It is
  339.       possible to change the default to decimal for numbers less than
  340.       16, or less than 10, using the decimal conversion function (see
  341.       below).
  342.  
  343.       DISPLAY/Decimal conversion:
  344.               By default, all numbers are show in hexdecimal.  You can
  345.       have numbers less than 16, or numbers less than 10, shown in
  346.       decimal throughout the file, by selecting one of the appropriate
  347.       sub-menu items.
  348.  
  349.       DISPLAY/Block-fill:
  350.               This function will probably not get much use.  It can be
  351.       used to set the data type of blocks of data.  For example, in a
  352.       particular file, there may a large section of code, maybe 100K or
  353.       so, and rather than rely on ReSource to make the correct
  354.       judgement of data type every time, you can set the data type of
  355.       every byte in the file to code, by doing the following:  Scroll
  356.       to the start of the block.  Set the data type here to CODE.
  357.       Select the "CURSOR/Remember" function.  Now, scroll to the end of
  358.       the block (don't use any function that stacks the cursor
  359.       position, such as "CURSOR/Absolute/End of file", as this will
  360.       change the remembered offset.  When you get to the end of the
  361.       block, select the "DISPLAY/Block-fill" function.  The type of
  362.       data at the start of the block will be echoed throughout the
  363.       entire block.
  364.  
  365.       DISPLAY/Fill-in data types:
  366.               This function has several uses, and will be one of the
  367.       most-used functions.  To understand what this function does, you
  368.       will need to know how ReSource keeps track of data types (see
  369.       section "Inside ReSource").  Suffice it to say, when you set the
  370.       data type anywhere within a file, that data type is immediately
  371.       echoed forward, to a maximum of several hundred bytes, but will
  372.       not change any other places where the data type has already been
  373.       set, or where there is an address symbol (label) on a line.
  374.       Where there is large areas of a file where the data type has not
  375.       been set, this function attempts to set the data type where
  376.       appropriate.  All of the above is done in the first pass.  On the
  377.       second pass, the length of each line is set, this is particularly
  378.       useful where there is large areas of ASCII.  This function should
  379.       always be used just before saving a file as source code (OUTPUT/
  380.       Save .asm).
  381.  
  382.       DISPLAY/Set counter:
  383.               The current offset in a file is always shown in the title
  384.       bar, in hexdecimal.  This is normal zero at the start of the
  385.       file.  You can change this, so that it is zero at somewhere other
  386.       than the start of the file, by using this function.  You may use
  387.       this function to measure the size of a hunk, for example.  To
  388.       "reset" the counter, use the function "DISPLAY/Reset counter".
  389.  
  390.       DISPLAY/Reset counter:
  391.               Resets the offset counter, in the title bar, so that it
  392.       is zero at the start of the file.  See "DISPLAY/Set counter".
  393.  
  394.       SYMBOLS:
  395.               When you create an assembly-language program, if you wish
  396.       to allocate some memory, you will probably have somewhere in you
  397.       file:
  398.  
  399.               JSR     _LVOAllocMem(A6)
  400.  
  401.       If you were to disassemble this program, this line of code would
  402.       be show as:
  403.  
  404.               JSR     -$0228(A6)
  405.  
  406.       , which is not particularly meaningful.  When disassembling a
  407.       program, if you can figure out which library base the A6 register
  408.       is pointing to (in this case, it would be the EXEC library), you
  409.       can get ReSource to make the appropriate substitution.  In this
  410.       example, you would select "SYMBOLS/E-G/Exec library".  Following
  411.       is another example:
  412.  
  413.               MOVE.L  #$00038007,D7
  414.               MOVE.L  4,A6
  415.               JSR     -$006C(A6)
  416.  
  417.       The second line loads Execbase into the A6 register, so you
  418.       should move the third line to the top of the display, and select
  419.       "SYMBOLS/E-G/Exec library".  Scroll back a couple of lines, and
  420.       you would see:
  421.  
  422.               MOVE.L  #$00038007,D7
  423.               MOVE.L  4,A6
  424.               JSR     _LVOAlert(A6)
  425.  
  426.       If you looked at the documentation for the Exec "Alert" call, you
  427.       would find that one of the input parameters is required to be in
  428.       the D7 register.  If you then looked in the include file "exec/
  429.       alerts.i", you would find that the number "$00038007" consists of
  430.       three values, OR'd together:
  431.  
  432.       AT_Recovery  -  AG_OpenLib  -  AO_DOSLib
  433.  
  434.       There is no need to go to all this trouble, simple line up the
  435.       first line with the top of the display, and select "SYMBOLS/A-B/
  436.       Alert codes", and ReSource will make the appropriate
  437.       substituition for you:
  438.  
  439.               MOVE.L  #AT_Recovery!AG_OpenLib!AO_DOSLib,D7
  440.               MOVE.L  4,A6
  441.               JSR     _LVOAlert(A6)
  442.  
  443.       Now isn't that much better than the original?  There are over 200
  444.       different classes of symbols that ReSource can substitute (only
  445.       two are enabled in the demo version).
  446.  
  447.               Consider the following lines of code:
  448.  
  449.               MOVE.L  4,A4
  450.               MOVE.L  #$100000,$003A(A4)
  451.  
  452.       Let's assume that you wish to substitute a symbol for the "$003A"
  453.       in the second line of code.  By default, ReSource will attempt to
  454.       substitute a symbol for the first number that it finds in a line
  455.       of code.  To change this, select "SYMBOLS/Set source/dest/
  456.       Destination", and then the appropriate symbol base (Exec library,
  457.       in this example).
  458.  
  459.       CURSOR/Remember:
  460.               Where it is possible to lose your place within a file by
  461.       using certain functions (such as "CURSOR/Absolute/Start of
  462.       file"), ReSource will store the current cursor location, just
  463.       prior to the function being executed.  To return to the previous
  464.       cursor location, select "CURSOR/Absolute/Previous location".
  465.       When you plan to return to a specific place within the file,
  466.       using this function will make it easier to do so.  It simply
  467.       stores the cursor location on a stack, for later access.
  468.  
  469.       CURSOR/Clear Loc stack:
  470.               The cursor location stack can contain up to 256
  471.       locations.  If more locations are "pushed" onto this stack, the
  472.       location at the bottom (the oldest) are forgotten.  This function
  473.       will empty the cursor location stack.
  474.  
  475.       CURSOR/Relative/Next byte:
  476.               The cursor position is incremented.
  477.  
  478.       CURSOR/Relative/Previous byte:
  479.               The cursor position is decremented.
  480.  
  481.       CURSOR/Relative/Next line:
  482.               Scroll forward by one line.
  483.  
  484.       CURSOR/Relative/Previous line:
  485.               Scroll backwards by one line.  The length of a line will
  486.       depend on what the data type is.  Until you first use "DISPLAY/
  487.       Fill-in data types", backwards scrolling may not be quite what
  488.       you expect.
  489.  
  490.       CURSOR/Relative/Next page:
  491.               Scroll forward by one page.  This will be approximately
  492.         20 lines.
  493.  
  494.       CURSOR/Relative/Previous page:
  495.               Scroll backwards by one page.  This will be approximately
  496.         20 lines.
  497.  
  498.       CURSOR/Relative/Skip forward:
  499.               Scroll forward by approx 4096 bytes ($1000).
  500.  
  501.       CURSOR/Relative/Skip Backward:
  502.               Scroll backward by approx 4096 bytes ($1000).
  503.  
  504.       CURSOR/Relative/Next unparsed code:
  505.               Scroll forward to the next line of code, that has been
  506.       labelled, and that has not been parsed for labels yet.
  507.  
  508.       CURSOR/Relative/Next data type change:
  509.               Scroll forward to the next byte whose data type is
  510.       different to the data type of the current byte.
  511.  
  512.       CURSOR/Relative/Previous data type change:
  513.               Scroll backward to the first byte found whose data type
  514.       is different to the data type of the current byte.
  515.  
  516.       CURSOR/Relative/Next uncertain data type:
  517.               Scroll forward to the next position within the file that
  518.       ReSource has labelled, but at the time was not quite sure of
  519.       which data type to set.
  520.  
  521.       CURSOR/Relative/Next backward reference:
  522.               Using the "CURSOR/Absolute/Backward reference" function,
  523.       it is possible to find the first reference to the current
  524.       position within the file.  Use this function to find further
  525.       references to the same position.  The search function could be
  526.       used instead, but may also find references within comments,
  527.       mnemonics, or even within other labels.
  528.  
  529.       CURSOR/Absolute/End of file:
  530.               Move cursor to the last line of the file.
  531.  
  532.       CURSOR/Absolute/Start of file:
  533.               Move cursor to the first line of the file.
  534.  
  535.       CURSOR/Absolute/Forward reference:
  536.               I'll use an example to explain this one:
  537.  
  538.                           JSR    lbC0132DE
  539.  
  540.               If you wanted to "check out" the subroutine at label
  541.       "lbC0132DE", but later return to the current cursor position,
  542.       simply scroll until this line is on the top line of the display,
  543.       and select "CURSOR/Absolute/Forward reference".  The current
  544.       cursor location is stored (on a stack), so that you can return to
  545.       this cursor position, using the "CURSOR/Absolute/Previous
  546.       location" function.
  547.  
  548.       CURSOR/Absolute/Forward reference:
  549.               This is similar to the "CURSOR/Absolute/Forward
  550.       reference" function, except that on a line such as:
  551.  
  552.                           MOVE.L  lbL00DEAF,lbL00BEEF
  553.  
  554.               the second label is used (lbL00BEEF), rather than the first
  555.       (lbL00DEAF).
  556.  
  557.       CURSOR/Absolute/Backward reference:
  558.               Use to find the first reference made to the current
  559.       cursor position.  See "CURSOR/Absolute/Next backward reference".
  560.  
  561.       CURSOR/Absolute/Previous location:
  562.               With many functions that change the cursor location
  563.       substantially, the current cursor position is stored on a stack.
  564.       To "pop" the last saved location, use this function.
  565.  
  566.       CURSOR/Scrolling speed:
  567.               You can select from five scrolling speeds.  This relates
  568.       to the speed/smoothness of scrolling when using the "CURSOR/
  569.       Relative/Next line" and "CURSOR/Relative/Previous line" functions.
  570.  
  571.       CURSOR/Search/Set search pattern:
  572.               You will be requested to input a string.  Unless you
  573.       select "CANCEL", the string you input will be searched for
  574.       immediately, starting at the current cursor position.  Normal ARP
  575.       wildcards are accepted:
  576.  
  577.                   (a|b|c)   Will match one of a, b or c.
  578.                             These can be patterns.
  579.  
  580.                   ? Matches any single character
  581.                   #<pat>   Pattern repeated 0 or more times,
  582.                            in particular, #? matches anything.
  583.  
  584.                   [char]   A set of characters, for example,
  585.                            [abc] or [a..c] specify the same set.
  586.  
  587.                   [^char]   Match everything but this set of characters.
  588.  
  589.                   *         0 or more occurances of any character.
  590.  
  591.       CURSOR/Search/Find next occurence:
  592.               Using the current search string, search forward from the
  593.       current cursor position.  See "CURSOR/Search/Set search pattern".
  594.  
  595.       LABELS/Create single/End-of-line comment:
  596.               You will requested for a string, which will be shown at
  597.       the end of the current line, starting with " ; ".
  598.  
  599.       LABELS/Create single/Full-line comment:
  600.               You will requested for a string, which will be shown on a
  601.       seperate line, previous to the current line, starting with "; ".
  602.       Generally, this will be used to add a comment too long to put at
  603.       the end of the current line.
  604.  
  605.       LABELS/Create single/Address symbol:
  606.               You will be requested for a string, which will become the
  607.       label for the current line.  Any references to the current line
  608.       will use the new label name, throughout the entire file,
  609.       immediately.
  610.  
  611.       LABELS/Create single/Address symbol dest:
  612.               The current line of code will be searched for references
  613.       to positions within the current file.  If any are found, ReSource
  614.       will make a decision on which type of data is at the position
  615.       referenced, it will then set the data type, and create a label at
  616.       that offset.  This new label will be immediately used for all
  617.       references to that location, which of course includes the
  618.       reference within the current line.  If the current line is not
  619.       being shown as code, or if there is no references, or there is a
  620.       reference, but it is outside of the range of the current file,
  621.       then this function will do nothing.  Normally, this function will
  622.       only be used within macros, as it is easier and quicker to hold
  623.       down the left Amiga key, while holding down the left mouse
  624.       button, possibly while scrolling also.
  625.  
  626.       LABELS/Create single/Value symbol:
  627.               Following is several examples of address symbols
  628.       (labels), and value symbols.
  629.  
  630.       lbC000124        MOVE.B   bm_Depth(A0),D0
  631.  
  632.       In the above line, "lbC000124" is an address symbol, and
  633.       "bm_Depth" is a value symbol.
  634.  
  635.                        MOVE.B   bm_Depth(A0),DepthByte
  636.  
  637.       In this line, "DepthByte" is and a reference to an address symbol
  638.       (label), NOT a value symbol.
  639.  
  640.                        MOVE.L   #MEMF_CLEAR,D1
  641.  
  642.       In this line, "MEMF_CLEAR" is a value symbol.  If a value symbol
  643.       had not been created for this line, the line would be:
  644.  
  645.                        MOVE.L   #$10000,D1
  646.  
  647.       Address symbols (labels) always equate to a position within the
  648.       file, while value symbols may equate to any value at all.
  649.       Unfortunately, there is several cases where a value symbol may
  650.       equate to a position within the file:
  651.  
  652.                        MOVEA.L   #lbC000134,A0
  653.                        JSR       (A0)
  654.  
  655.       In this case, you may assign a value symbol, in which case the
  656.       value symbol will be shown, not the label name of the position
  657.       within the file that the instruction refers to.  If however, you
  658.       later remove the value symbol, the then label name of the line
  659.       being referenced (at present, this is "lbC000134"), will be
  660.       shown.  When you create an address symbol or value symbol, the
  661.       name is NOT checked for validity, it is up to you to decide
  662.       whether or not the assembler that you will be using will accept
  663.       the resulting code.  For example:
  664.  
  665.                        MOVE.L    #FFFFFFFA,D0
  666.  
  667.       may be changed to:
  668.  
  669.                        MOVE.L    #-6,D0
  670.  
  671.       by creating a value symbol "-6".  Virtually any value can be
  672.       given a value symbol, including bit numbers:
  673.  
  674.                        BTST      #AFB_68020,$0124(A6)
  675.  
  676.       LABELS/Create single/Value symbol - dest:
  677.               Similar to "LABELS/Create single/Value symbol" function,
  678.       except that the second reference within the current line will
  679.       used, rather than the first:
  680.  
  681.                        BTST      #4,SysFlags(A6)
  682.  
  683.       LABELS/Edit single:
  684.               All of these functions are identical to their
  685.       counterparts in "LABELS/Create single", except that if their is
  686.       an existing label/symbol/comment, you will be requested to edit
  687.       it, rather than create a new one.  Given the editing capabilities
  688.       of a string gadget, the create functions are a luxury really,
  689.       although I find that when I change a label/symbol/comment, I
  690.       generally make it nothing like the original, hence I nearly
  691.       always use the create functions, to save me the trouble of
  692.       pressing "rAmiga-X".
  693.  
  694.       LABELS/Remove single/Address symbol:
  695.               Remove any address symbol (label) for the current line.
  696.  
  697.       LABELS/Remove single/Value symbol:
  698.               Remove ALL value symbols in the current line.
  699.  
  700.       LABELS/Remove single/End-of-line comment:
  701.               Remove any end-of-line comment for the current line.
  702.  
  703.       LABELS/Remove single/All:
  704.               Remove all symbols and comments for the current line.
  705.  
  706.       LABELS/Create multiple/Reloc32 all:
  707.               For each reloc32 pointer within the current file,
  708.       determine the data type being referenced, set the data type, and
  709.       create a label at that address.  This function should be used
  710.       with caution, as when it makes a decision on the data type, it
  711.       does not have the same information available as when creating
  712.       labels normally.  This function should be most useful after
  713.       creating labels from all code in a program, where there is one or
  714.       more large tables of pointers.
  715.  
  716.       LABELS/Create multiple/All:
  717.               Starting at the current address, the "LABELS/Create
  718.       single/Address symbol dest" function is executed, and if ReSource
  719.       thinks that there was valid code in the current line, the
  720.       "CURSOR/Relative/Next line" function is executed, and the entire
  721.       function loops, otherwise the "PROJECT/-=Abort=-" function is
  722.       executed.  This function can make the disassembly process very
  723.       fast, the disadvantage being that there is a very slight chance
  724.       that what ReSource thinks is valid code, is really ascii, and
  725.       invalid labels will be created.
  726.  
  727.       SPECIAL FUNCTIONS/Repeat last command:
  728.               Execute the last function that was executed.  This does
  729.       not include most cursor movements.  By rebinding this function to
  730.       an easily-accessed key, such as the space bar, (and saving the
  731.       keytable) there should be much less need to rebind keys often.
  732.  
  733.       SPECIAL FUNCTIONS/Convert xx(A4) EA's
  734.               These functions were specifically designed to be used
  735.       when disassembling 'C' programs, in which the A4 register is used
  736.       as a base register for accessing data, throughout all or most of
  737.       the program.  Let's use an example program here:
  738.  
  739.                           SECTION  test000000,CODE
  740.                           LEA      START+$11E,A4
  741.                           LEA      0(A4),A1
  742.                           MOVE.L   $000C(A4),D0
  743.       .... rest of code
  744.                           SECTION  test00011E,DATA
  745.                           dc.b     'dos.library',0
  746.                           dc.l     $00010001
  747.                           END
  748.  
  749.       In the above program, the A4 register will point to the start of
  750.       the data segment.  There are three ways to tell ReSource where
  751.       the A4 register will point to; in the above example, the "This
  752.       operand" function could be used with the cursor at start of file,
  753.       or the "This address" function could be used with the cursor at
  754.       offset $00011E, or the "Specify" function could be used, suppying
  755.       a parameter of "11E".  Basically, with this function, you are
  756.       telling ReSource where, relative to the start of the program, the
  757.       A4 register can be assumed to be pointing.  After you do this,
  758.       any effective address that involves a word offset to the A4
  759.       register, will be shown as an absolute address.  Thus, the
  760.       example program above will appear as:
  761.  
  762.                           SECTION  test000000,CODE
  763.                           LEA      START+$011E,A4
  764.                           LEA      START+$011E,A1
  765.                           MOVE.L   START+$012A,D0
  766.       .... rest of code
  767.                           SECTION  test00011E,DATA
  768.                           dc.b     'dos.library',0
  769.                           dc.l     $00010001
  770.                           END
  771.  
  772.       The advantage here is that labels can automatically be created
  773.       where they could not before.  If this conversion process is not
  774.       used, it is likely that the program will not successfully re-
  775.       assemble, as different assemblers assemble the same source code
  776.       into different opcodes.  For example, the assembler that I
  777.       normally use does virtually no optimizing, and so the resulting
  778.       program is often larger than the original, even if I did not
  779.       modify the source code.  For example:
  780.  
  781.                           MOVE.L   4,A6
  782.  
  783.       If absolute long addressing is used, the instruction above will
  784.       be 6 bytes long, whereas if absolute short addressing is used, it
  785.       will be only 4 bytes long.  Where you wish to do EA conversions
  786.       in only a portion of a program, you can set the lower and upper
  787.       limits.
  788.  
  789.       Changing to absolute EA's will increase the size of the resulting
  790.       program, unless you convert back to relative addressing, within
  791.       the source code.  I believe that one of the features of BLINK
  792.       (from the Software Distillery) can help to make this conversion.
  793.  
  794.       SPECIAL FUNCTIONS/Convert specific EA's:
  795.               Please read and understand the "SPECIAL FUNCTIONS/Convert
  796.       xx(A4) EA's" functions first!  Where you want to do specific EA
  797.       conversions, use "Set base #1" (or #2, or #3), when the cursor is
  798.       the same as where the base register (whatever that is, it does
  799.       not have to be A4 this time) can be assumed to point to.
  800.       Assuming that you set base #1, and it is the A5 register that is
  801.       being used as a base register, you will then use the "Convert W/
  802.       Base #1" function to convert lines like:
  803.  
  804.                           MOVE.L   $0032(A5),A6
  805.  
  806.       .. into:
  807.  
  808.                           MOVE.L   lbL0014AC(A5),A6
  809.  
  810.       Note here that there has not actually been an EA conversion, but
  811.       a label has been created, the data type at label "lbL0014AC" has
  812.       been determined and set, and a value symbol ("lbL0014AC") has
  813.       been created for this line.  It is up to you then to make the
  814.       necessary changes to the resulting source code, if re-assembling
  815.       is required.  Whereas the "Convert xx(A4) EA's" function converts
  816.       immediately and automatically, you must use the "Convert W/Base
  817.       #1" function on each line that you want converted.  If you wish
  818.       to convert a destination address, first use the "SYMBOLS/Set
  819.       source/dest/Destination" function first.
  820.  
  821. MACROS:
  822.               There are currently twelve user-definable macros
  823.       available in ReSource.  To start macro #1, select "MACROS/Start/
  824.       #1", select the functions to be included in the macro (you can
  825.       use the menus, or press keys, it's all the same thing to the
  826.       macro).  When you are done, select "MACROS/Start/#1" again, to
  827.       end the macro.  To run the macro, select "MACROS/Execute/#1".
  828.       The display is always refreshed during the defining of a macro,
  829.       however it is not during the execution.  At the end of a macro,
  830.       the display is always refreshed.  You may nest macros, but you
  831.       should not use recursion.  If ReSource finds that the nesting
  832.       level has exceeded 40, the macro will be abandoned.
  833.  
  834.               Macro files can be saved and re-loaded.  When ReSource
  835.       first starts up, it looks for "S:RS.macros".  If it finds it, it
  836.       will load it, and execute macro #12 immediately (that is why
  837.       macro #12 is hilited in the menus).  This is used to configure
  838.       ReSource.  Just start macro #12, set what option you want, end
  839.       macro #12, save the macro file as "S:RS.macros", and ReSource
  840.       will be configured every time that you run it.
  841.  
  842. KEY BINDINGS:
  843.               Every function in ReSource can be found in the menus.
  844.       You do not need to use any keys at all, but you probably will
  845.       want to.  You can bind any function to any key.  All Amiga keys
  846.       are supported, you may use shift, alt, ctl, lAmiga, rAmiga,
  847.       shift-alt, shift-ctl, alt-ctl, or shift-alt-ctl in combination
  848.       with any key, as a distinct key to bind a function to.  Thus, you
  849.       have complete control over which keys do what.  After re-binding
  850.       some keys, you will probably want to save the keytable.  If you
  851.       save the keytable as "S:RS.keytable", it will be loaded every
  852.       time you run ReSource.  You may want to create several keytables,
  853.       suitable for doing differing program types (C, assembler, etc.).
  854.  
  855.       OPTIONS/Show offsets:
  856.               If this option is set to ON, all lines will start with
  857.       either a label, or the offset from the start of the file.
  858.  
  859.       OPTIONS/Display Beep:
  860.               If this option is set to ON, the "BeepDisplay" function
  861.       is used to give feedback to the user, that either a function has
  862.       failed, or that a lengthy function has completed, and that the
  863.       user should now wake up.
  864.  
  865.       OPTIONS/User Feedback:
  866.               If this option is set to ON, messages will appear in the
  867.       title bar, to let the user know what ReSource is doing,
  868.       especially while doing functions that take a lot of time,
  869.       extraordinary functions that only ReSource has direct control
  870.       over (such as dynamically allocating more memory for strings,
  871.       etc.), and also information about what hunks, etc., that it finds
  872.       in a load file.
  873.  
  874.       OPTIONS/Feedback Delays:
  875.               If this option is set to ON, whenever a feedback message
  876.       is displayed, ReSource will wait for you to read the message,
  877.       before continuing.  You will probably not want to keep this on
  878.       all the time, as it can slow down the disassembly process
  879.       somewhat, but while you are learning to use ReSource, it will
  880.       probably be very useful.
  881.  
  882.       OPTIONS/Labels:
  883.               If this option is set to ON, labels will be displayed.  This is
  884.       the default.
  885.  
  886.  
  887.       OPTIONS/Value symbols:
  888.              If this option is set to ON, value symbols will be displayed.
  889.       This is the default.
  890.  
  891.       OPTIONS/End-of-line comments:
  892.              If this option is set to ON, end-of-line comments will be
  893.       displayed.  This is the default.
  894.  
  895.       OPTIONS/Full-line comments:
  896.              If this option is set to ON, full-line comments will be
  897.       displayed.  This is the default.
  898.  
  899.       Don't forget to put arp.library in your LIBS: directory!
  900.